<template>
	<view>
		<title-bar title="填写邀请码" :line="true"></title-bar>
		<image class="logo" src="../static/cxlogo.png" mode="widthFix"></image>
		<view class="tx-code">
			填写邀请人的邀请码
		</view>
		<input placeholder="请输入邀请码" class="code-input" type="text" v-model="code" />
		<view class="ok" @tap="submit()">
			确认
		</view>
		<view class="tis">
			没有上级邀请可不填邀请码直接跳过
		</view>
		<view class="pass" @tap="back()">
			跳过
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code: ""
			}
		},
		methods: {

			// 提交
			submit() {
				let data = {
					code: this.code
				}
				this.$utils.postrequest('/api/bind_user_code', data, res => {
					if (res.code == 200) {
						uni.showToast({
							title: "绑定成功"
						})

						setTimeout(res => {
							uni.navigateBack();
						},1000)
					}
				})
			},
			back() {
				uni.setStorageSync("pidPass", true);
				uni.navigateBack();
			}
		}
	}
</script>

<style scoped lang="scss">
	@import "./invitation-code.scss";
</style>
